// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Numerics;

using IronPython.Modules;
using IronPython.Runtime.Exceptions;

using Microsoft.Scripting.Runtime;

namespace IronPython.Runtime.Types {
    public static class TypeCache {
        #region Generated TypeCache Storage

        // *** BEGIN GENERATED CODE ***
        // generated by function: gen_typecache_storage from: generate_typecache.py

        private static PythonType? array;
        private static PythonType? builtinfunction;
        private static PythonType? pythondictionary;
        private static PythonType? frozensetcollection;
        private static PythonType? pythonfunction;
        private static PythonType? builtin;
        private static PythonType? obj;
        private static PythonType? setcollection;
        private static PythonType? pythontype;
        private static PythonType? str;
        private static PythonType? bytes;
        private static PythonType? bytearray;
        private static PythonType? pythontuple;
        private static PythonType? weakreference;
        private static PythonType? pythonlist;
        private static PythonType? pythonmodule;
        private static PythonType? method;
        private static PythonType? enumerate;
        private static PythonType? intType;
        private static PythonType? singleType;
        private static PythonType? doubleType;
        private static PythonType? biginteger;
        private static PythonType? complex;
        private static PythonType? super;
        private static PythonType? nullType;
        private static PythonType? boolType;
        private static PythonType? baseException;

        // *** END GENERATED CODE ***

        #endregion

        #region Generated TypeCache Entries

        // *** BEGIN GENERATED CODE ***
        // generated by function: gen_typecache from: generate_typecache.py

        public static PythonType Array
            => array ??= DynamicHelpers.GetPythonTypeFromType(typeof(Array));

        public static PythonType BuiltinFunction
            => builtinfunction ??= DynamicHelpers.GetPythonTypeFromType(typeof(BuiltinFunction));

        public static PythonType Dict
            => pythondictionary ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonDictionary));

        public static PythonType FrozenSet
            => frozensetcollection ??= DynamicHelpers.GetPythonTypeFromType(typeof(FrozenSetCollection));

        public static PythonType Function
            => pythonfunction ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonFunction));

        public static PythonType Builtin
            => builtin ??= DynamicHelpers.GetPythonTypeFromType(typeof(Builtin));

        public static PythonType Object
            => obj ??= DynamicHelpers.GetPythonTypeFromType(typeof(Object));

        public static PythonType Set
            => setcollection ??= DynamicHelpers.GetPythonTypeFromType(typeof(SetCollection));

        public static PythonType PythonType
            => pythontype ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonType));

        public static PythonType String
            => str ??= DynamicHelpers.GetPythonTypeFromType(typeof(String));

        public static PythonType Bytes
            => bytes ??= DynamicHelpers.GetPythonTypeFromType(typeof(Bytes));

        public static PythonType ByteArray
            => bytearray ??= DynamicHelpers.GetPythonTypeFromType(typeof(ByteArray));

        public static PythonType PythonTuple
            => pythontuple ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonTuple));

        public static PythonType WeakReference
            => weakreference ??= DynamicHelpers.GetPythonTypeFromType(typeof(WeakReference));

        public static PythonType PythonList
            => pythonlist ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonList));

        public static PythonType Module
            => pythonmodule ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonModule));

        public static PythonType Method
            => method ??= DynamicHelpers.GetPythonTypeFromType(typeof(Method));

        public static PythonType Enumerate
            => enumerate ??= DynamicHelpers.GetPythonTypeFromType(typeof(Enumerate));

        public static PythonType Int32
            => intType ??= DynamicHelpers.GetPythonTypeFromType(typeof(Int32));

        public static PythonType Single
            => singleType ??= DynamicHelpers.GetPythonTypeFromType(typeof(Single));

        public static PythonType Double
            => doubleType ??= DynamicHelpers.GetPythonTypeFromType(typeof(Double));

        public static PythonType BigInteger
            => biginteger ??= DynamicHelpers.GetPythonTypeFromType(typeof(BigInteger));

        public static PythonType Complex
            => complex ??= DynamicHelpers.GetPythonTypeFromType(typeof(Complex));

        public static PythonType Super
            => super ??= DynamicHelpers.GetPythonTypeFromType(typeof(Super));

        public static PythonType Null
            => nullType ??= DynamicHelpers.GetPythonTypeFromType(typeof(DynamicNull));

        public static PythonType Boolean
            => boolType ??= DynamicHelpers.GetPythonTypeFromType(typeof(Boolean));

        public static PythonType BaseException
            => baseException ??= DynamicHelpers.GetPythonTypeFromType(typeof(PythonExceptions.BaseException));

        // *** END GENERATED CODE ***

        #endregion
    }
}
